package com.example.demo01.Controller.webController;

import com.example.demo01.Entity.webEntity.TDTGeoCode;
import com.example.demo01.Service.webService.TDTGeoCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TDTGeoCodeController {
    @Autowired
    private TDTGeoCodeService tdtGeoCodeService;
    @Autowired
    private TDTGeoCode tdtGeoCode;

    /**
     * @param address 目标地址名称
     * @return 包含经纬度信息的json字符串
     */
    @RequestMapping("/tdtgeocode/GET/byaddress")
    public String getGeoCodeInfo(
            @RequestParam(value = "address", required = false, defaultValue = "河南省焦作市") String address) {
        tdtGeoCode.setAddressName(address);
//        System.out.println(tdtGeoCode);
        return tdtGeoCodeService.getGeoCodeInfo(tdtGeoCode.toString());
    }
}
